#pragma once
#include <vector>
#include "lexer.h"
#include "moleweight.h"

#include <iostream>

class Parser {
	std::vector<Token> tokens;
	int position = 0;
public:
	Parser();
	Parser(std::vector<Token> tokens);
	double parse();
private:
	bool isEnd();
	inline Token advance();
	inline void backward();
	inline Token peek();
	double parseTotal();
	double parsePrefixGroup();
	double parseGroup();
	double parseAtom();
	double parsePrefix();
	double parseSubfix();
	double parseElement();
	void error(std::string info);
};